 <script>
		$(document).ready(function(){
		  $(".login_msg").hide();
			/*
			 * Validate the form when it is submitted
			 */
			var validatelogin = $("#login-form").validate({
				invalidHandler: function(form, validator) {
					var errors = validator.numberOfInvalids();
					if (errors) {
                        var message="<?php echo __("Hãy nhập Tài khoản và Mật khẩu");?>";                    
						$('.box .content').removeAlertBoxes();
						$('.box .content').alertBox(message, {type: 'warning', icon: true, noMargin: false});
						$('.box .content .alert').css({
							width: '',
							margin: '0',
							borderLeft: 'none',
							borderRight: 'none',
							borderRadius: 0
						});
					} else {
						$('.box .content').removeAlertBoxes();
					}
				},
				showErrors : function(errorMap, errorList) {
				},
				submitHandler: function(form) {
					var username=$('.username').val();
                    var pword=$('.password').val();
                    
                    $.ajax({
            			type: "POST",
            			url: BASE_URL+"/auth/check",
            			data: $('#login-form').serialize(),
            			success: function(response)
            			{
                            var getData=$.parseJSON(response);
                            //alert(getData.message);
            				if(getData.check == 1)
                            {
                                $("#login-form").slideUp('slow', function() {
            					    $(".login_msg").show('fast');
            						$(".login_msg").html("<p class='alert info'><span class='icon'></span><?php echo __("Đăng nhập thành công!");?></p>");

                                    document.location = BASE_URL + '/' +DEFAULT_CONTROLLER;                                    
            					});   
                            }
            				else
            					{
            					   // ??? chuyển như thế nào từ js sang php/
            					   show_msg(getData.message);
            					}
                            	
            			}
            		});
				}
			});    
		});
        
        function show_msg(msg){
        $('.box .content').removeAlertBoxes();
        $('.box .content').alertBox(msg, {type: 'error', icon: true, noMargin: false});
        $('.box .content .alert').css({
							width: '',
							margin: '0',
							borderLeft: 'none',
							borderRight: 'none',
							borderRadius: 0
		});
        }
        
</script>
        
<div class="top">
			<div class="gradient"></div>
			<div class="white"></div>
			<div class="shadow"></div>
		</div>
		<div class="content">
			<h1><?php echo $this->config->item('app_name');?></h1>
			<div class="background"></div>
			<div class="wrapper">
            
				<div class="box">
					<div class="header grey">
						<img src="<?php echo THEME_PATH.$userCurrentTheme?>/img/icons/packs/fugue/16x16/lock.png" width="16" height="16">
						<h3><?php echo __("Đăng nhập hệ thống");?></h3>
					</div>
                    
					<form method="get" action="" id="login-form">
						<div class="content no-padding">
                        
							<div class="section _100">
								<label>
									<?php echo __("Tài khoản")?>
								</label>
								<div>
									<input name="username" type="text" class="required username" value="<?php echo $loginSaveData->username?>"/>
								</div>
							</div>
							<div class="section _100">
								<label>
									<?php echo __("Mật khẩu")?>
								</label>
								<div>
									<input name="password" type="password" class="required password" <?php echo $loginSaveData->password?>/>
								</div>
							</div>
						</div>
						<div class="actions">
							<div class="actions-left" style="margin-top: 8px;">
								<label for="newsletter2">
									<input name="autologin" type="checkbox" <?php if(!empty($loginSaveData)){ echo 'checked="checked"';} ?> hidden="hidden"/>
									<?php echo __("Duy trì đăng nhập");?>
								</label>
							</div>
							<div class="actions-right">
								<input type="submit" value="<?php echo __("Đăng nhập");?>"/>
							</div>
						</div>
					</form>
                    
                    <div class="login_msg content no-padding with-actions grey " style="padding: 0 20px; color:red;">
                    <?php echo __("Đăng nhập");?> 
                    </div>
                    
				</div>
				<div class="shadow"></div>
                
                <div style="text-align:center"><a href="<?php echo site_url("auth/auth/forgot");?>"><?php echo __("Quên mật khẩu?");?> </a> &nbsp; &nbsp; 
                <a href="<?php echo site_url("member/register");?>"><?php echo __("Chưa có tài khoản?");?></a></div>
                
                <div class="">
                    <div class="header ">
						
						<h3><?php echo __("Đăng nhập hệ thống với tài khoản ");?></h3>
					</div>
                    <div class="content no-padding" id="openid"> 
                    <style>
                    #openid a {
                        border: 1px solid #DDDDDD;
                        float: left;
                        height: 60px;
                        margin: 3px;
                        width: 100px;
                    }
                    #openid .google {
                        background: url("<?php echo BASE_URL; ?>uploads/openid-providers-en.png") repeat scroll 0 0 #FFFFFF;
                    }
                    #openid .yahoo {
                         background: url("<?php echo BASE_URL; ?>uploads/openid-providers-en.png") repeat scroll -100px 0 #FFFFFF;
                    }
                    #openid a:hover{
                        background-color: #FFFCC9;
                        border:2px solid #ffccc9;
                    }
                    </style>
                        <a href="<?php echo BASE_URL."index.php/foo/loginplus?provider=google" ?>"  class="google"></a>
                        <a href="<?php echo BASE_URL."index.php/foo/loginplus?provider=yahoo" ?>" class="yahoo"></a>
                    </div>
                    
                </div>
                <div class="shadow"></div>
			</div>
		</div>